<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>

        // 展开运算符   ...



        // 数组的深复制

        const arr = [1, 2, 3];

        const arr2 = [...arr];

        console.log(arr2);

        arr.push(4);

        console.log(arr2);

        console.log(...arr2);


        const ar3 = [1, 2];
        const ar4 = [5, 6];
        const ar5 = [...ar3, 0, ...ar4, 7, 8, 9];
        console.log(ar5);



        const obj1 = { a: 1, b: 2 };

        const obj2 = { ...obj1 };
        console.log(obj2);


        const obj3 = { ...obj1, c: 3 };
        console.log(obj3);




    </script>

</body>

</html>